import {NestMiddleware,Injectable} from '@nestjs/common';
import {Request, Response, NextFunction} from 'express'
import {AppService} from './app.service';

// 需要在中间件内使用 provider服务加上Injectable装饰器
@Injectable()
export class LoggerMiddleware implements NestMiddleware {
    constructor(private appService:AppService) {
    }
    use(req: Request, res: Response, next: NextFunction) {
        console.log('LoggerMiddleware use method','---','LoggerMiddleware.appService',this.appService.log('hello app service'));
        // res.send("中间件的response.send")
        next();
    }
}
